<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Vue页面结构</title>
    <script src="./lib/vue-2.4.0.js"></script>
    <link rel="stylesheet" href="./lib/animate.css">
    <style>
        .p{
            width: 100px;
        }
    </style>
</head>
<body>
    <div id="app">

        <transition
            v-on:before-enter="beforeEnter"
            v-on:enter="enter"
            v-on:after-enter="afterEnter"
            v-on:before-leave="beforeLeave"
            v-on:leave="leave"
            v-on:after-leave="afterLeave"
        > 
            <p class="p" v-show="show">hello vuejs</p>
        </transition> 
        <button @click="show=!show">钩子函数</button>

    </div>
</body>
<script>
    var vm=new Vue({
        el:'#app',
        data:{
            show:true
        },
        methods:{
            beforeEnter(el){
                el.style.opacity = 0
                el.style.transform='rotateY(0deg)'
            },
            enter(el,done){
                el.style.opacity=0.5;
                el.style.transform='rotateY(90deg)'
                el.style.transition = 'all 1s ease'
                done();
            },
            afterEnter(el){
                el.style.opacity=1;
                el.style.transform='rotateY(360deg)'
            },
            beforeLeave(el){
                el.style.opacity = 1
                el.style.transform='rotateY(360deg)'
            },
            leave(el,done){
                el.style.opacity = 0
                el.style.transform='rotateY(90deg)'
                el.style.transition = 'all 1s ease'
                // done()
            },
            afterLeave(el){
                el.style.opacity = 0
                el.style.transform='rotateY(0deg)'
            }

        },
        //生命周期函数
        created:function(){
        },
        mounted:function(){
        }
    });
</script>
</html>